@@ -44,15 +44,20 @@ module Agents |
||
| 44 | 44 |
end |
| 45 | 45 |
|
| 46 | 46 |
def wunderground |
| 47 |
- Wunderground.new("your-api-key")
|
|
| 47 |
+ Wunderground.new(options[:api_key]) |
|
| 48 | 48 |
end |
| 49 | 49 |
|
| 50 | 50 |
def default_options |
| 51 |
- { :zipcode => "94103" }
|
|
| 51 |
+ {
|
|
| 52 |
+ :api_key => "", |
|
| 53 |
+ :zipcode => "94103" |
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 52 | 56 |
end |
| 53 | 57 |
|
| 54 | 58 |
def validate_options |
| 55 | 59 |
errors.add(:base, "zipcode is required") unless options[:zipcode].present? |
| 60 |
+ errors.add(:base, "api_key is required") unless options[:api_key].present? |
|
| 56 | 61 |
end |
| 57 | 62 |
|
| 58 | 63 |
def check |
@@ -67,4 +72,4 @@ module Agents |
||
| 67 | 72 |
Time.zone.at(day["date"]["epoch"].to_i).to_date == Time.zone.now.tomorrow.to_date |
| 68 | 73 |
end |
| 69 | 74 |
end |
| 70 |
-end |
|
| 75 |
+end |